package com.shanzmoo.db.sys.entity.vo;

import com.shanzmoo.db.sys.entity.AddressEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * 地址树对象
 * @author: Gzhao 2020/12/8
 */
@Data
@Accessors(chain = true)
@ApiModel("地址树对象")
public class AddressTreeVo {

    @ApiModelProperty("地区编号")
    private Integer addressCode;

    @ApiModelProperty("地区名称")
    private String addressName;

    @ApiModelProperty("子地址" )
    private List<AddressTreeVo> children;

    public static AddressTreeVo create(AddressEntity address) {
        return new AddressTreeVo().setAddressCode(address.getAddressCode()).setAddressName(address.getAddressName());
    }
}
